﻿<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>		
	<title>ProLinear</title>	
	<link rel="stylesheet" type="text/css"
		href="#{request.contextPath}/resources/css/style.css" />
	<style>
.ui-editor {
	width: 100% !important;
}
</style>
</h:head>
<h:body>
	<div align="center">
		<p:growl id="messages" />
		<h:form id="geral">
			<p:layout fullPage="true">
				<p:layoutUnit position="center">
					<ui:insert name="conteudo" />
				</p:layoutUnit>
				<p:layoutUnit position="north" size="60" resizable="true">
					<p:toolbar style="height:100%" id="ferramentas">
						<p:toolbarGroup align="left">
							<h:outputLabel value="Olá, #{homeBean.usuario.nome} " />
						</p:toolbarGroup>
						<p:toolbarGroup align="center">
							<ui:insert id="barra" name="barra" />
						</p:toolbarGroup>

						<p:toolbarGroup align="right">
							<p:commandButton icon="ui-icon-help" title="Ajuda"
								style="width:40px" action="/pages/help.jsf?faces-redirect=true" />
							<p:button icon="ui-icon-power" title="Sair"
								href="/j_spring_security_logout" style="width:40px" />
						</p:toolbarGroup>
					</p:toolbar>

				</p:layoutUnit>
				<p:layoutUnit position="west" width="240" header="Menu"
					collapsible="true">
					<h:form>
						<p:menu style="width:100%">
							<p:menuitem value="Novo" style="text-align:center"
								url="/pages/auth/documento.jsf" />
							<p:menuitem value="Meus Documentos"
								url="/pages/user/home.jsf?tipo=1" />
							<p:menuitem value="Documentos Compartilhados"
								style="text-align:center" url="/pages/user/home.jsf?tipo=2" />
							<p:menuitem value="Documentos Públicos"
								url="/pages/user/home.jsf?tipo=3" />
							<p:menuitem value="Todos os documentos"
								url="/pages/user/home.jsf?tipo=4" />
							<p:menuitem value="Meus Dados"
								url="/pages/cadastro.jsf"
								/>
							<p:menuitem value="Desativar Conta" onclick="confirmation.show()" />
						</p:menu>
					</h:form>
				</p:layoutUnit>
			</p:layout>
			<p:dialog id="shareDialog" header="Compartilhar Documento"
				widgetVar="dlgShare" modal="true" height="155" width="550"
				draggable="false" resizable="false">
				<h:panelGrid id="grid" columns="2" cellpadding="5" cellspacing="5">
					<h:outputText value="Endereços" />
					<p:inputText value="#{homeBean.emailCompartilhamento}"
						style="width:300" 
						requiredMessage="O email é obrigatório" />
					<p:selectBooleanCheckbox value="#{homeBean.permiteEscrita}"
						disabled="#{homeBean.permiteEscritaDisabled}"
						itemLabel="Permite Escrita" />
					<p:selectBooleanCheckbox value="#{homeBean.publico}"
						itemLabel="Público" update="formDlg">
						<p:ajax update="grid" listener="#{homeBean.checkBoxChange}" />
					</p:selectBooleanCheckbox>
				</h:panelGrid>
				<h:panelGrid columns="2" cellpadding="5">
					<p:commandButton value="OK" style="width:50px" ajax="false"
						actionListener="#{homeBean.compartilha}"
						oncomplete="dlgShare.hide()">
					</p:commandButton>
					<p:commandButton value="Cancelar" onclick="dlgShare.hide()"
						immediate="true" />
				</h:panelGrid>
			</p:dialog>
			<p:confirmDialog id="confirmDialog"
				message="Tem certeza que deseja desativar sua conta?"
				header="Confirmação" severity="alert" widgetVar="confirmation">
				<p:commandButton value="Sim" ajax="false"
					actionListener="#{homeBean.desativarConta}"
					oncomplete="confirmation.hide()" />
				<p:commandButton value="Não" onclick="confirmation.hide()" />
			</p:confirmDialog>
		</h:form>
	</div>
</h:body>
</html>